<?php get_header(); ?>

	<div id="content">

	<?php if (have_posts()) : ?>

	<div class="archive-title">
		<h2>Search Results</h2>
		<p>Search Results for: <?php the_post(); echo '<span>'. $s .'</span>'; rewind_posts(); ?></p>
	</div>

		<?php while (have_posts()) : the_post(); ?>

			<div class="post" id="post-<?php the_ID(); ?>">
<?php $data = get_post_meta( $post->ID, 'post-images', true ); ?> 
<?php // if there's a single post image
 if( $data[ 'post-image-main' ] ) : ?>
				<div class="thumb-main">
				<a href="<?php the_permalink() ?>" rel="bookmark" title=""><img height="160px" width="305px" alt="" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $data[ 'post-image-main' ]; ?>&amp;h=160&amp;w=305&amp;zc=1&amp;q=100" /></a>
				</div>
<?php else: ?>
				<div class="thumb-main">
				<a href="<?php the_permalink() ?>" rel="bookmark" title=""><img height="160px" width="305px" alt="" src="<?php bloginfo('stylesheet_directory'); ?>/images/no-thumbnail-main.png" /></a>
				</div>
<?php endif; ?> 
				<div class="entry-main">
				<div class="home-title"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div>
					<?php the_content_limit(320, ""); ?>
				</div>
				<div> <!-- blank div necessary for IE6 -->
				<div class="clear-position"><div class="comment-count"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></div><div class="read-more"><a href="<?php the_permalink() ?>" rel="bookmark" title="Read more of <?php the_title_attribute(); ?>">Read More</a></div><div class="author"><?php the_author_posts_link(); ?></div></div>
				</div>
			</div>

		<?php endwhile; ?>

<?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else {echo '<div class="alignleft">';posts_nav_link('','','&laquo; Previous Entries'); echo '</div><div class="alignright">';posts_nav_link('','Next Entries &raquo;',''); echo '</div>'; } ?>

	<?php else : ?>

		<div class="archive-title">
		<h2 class="center">No posts found. Try a different search term?</h2>
		<form id="searchform" method="get" action="<?php bloginfo('home'); ?>/"> <input type="text"  size="18" maxlength="50" name="s" id="s" /> 
		<input name="submit" type="image" src="<?php bloginfo('stylesheet_directory'); ?>/images/go2.png" value="Search" Title="Search" class="search-button"/></form> 
		<br />
		</div>
		
	<?php endif; ?>

	</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>